#ifndef TREE_H
#define TREE_H
#include <iostream>
#include <vector>
#include "Parser.h"
using namespace std;

template <class T>
class Tree
{
    friend class Parser;
    friend Tree<string> tree_generator(string listraw);
public:
    Tree(T item);
    void insert(Tree *branch);
    void printTree(int indent = 0);
    T item() { return _item; }
    bool leaf() { return branches.empty(); }
    bool root() {return father == nullptr;};

private:
	Tree *father = nullptr;
    T _item;
    vector<Tree<T> *> branches;
};

Tree<string> tree_generator(string listraw);
#endif